
#include "Message.hpp"
#include "DataTypes.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/thread.hpp"


namespace netspy
{

class RequestManager
{

public:
	static RequestManager & getInstance()
	{
		static RequestManager requestManager;
		return requestManager;	
	}

	/// do pobierania wiadomości przez wątek
	shared_msg getRequest();

	/// do zapisu wiadomości
	void storeResult(shared_msg result);
	void run();

private:
	/// wiadomości otrzymane od klientów
        MessageQueue results_;
	/// wiadomości wysłane do klientów
        MessageQueue requests_;

        void generateRequests();
        void saveResults();

        bool isRunning_;
        client_vec_ptr clients;
        service_vec_ptr services;
        client_service_map_ptr serviceMap;
        boost::thread requestHandler_;
        boost::thread resultHandler_;

        RequestManager():isRunning_(false){}
        RequestManager(RequestManager &req);
        RequestManager& operator=(const RequestManager&);

};
}

